﻿namespace IBTrader.Modules.Configuration
{    
    using System.Collections.Generic;
    using System.Configuration;
    using System.Linq;

    abstract class CollectionBase<T> : ConfigurationElementCollection where T : ConfigurationElement, new()
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new T();
        }
        protected override object GetElementKey(ConfigurationElement element)
        {
            return element.ToString();
        }
        public new IEnumerator<T> GetEnumerator()
        {
            return this.OfType<T>().GetEnumerator();
        }
    }
}
